package com.ai.service.made.impl;

import com.ai.common.CommonResponse;
import com.ai.entity.made.CoalRoutingInspectionAlarmRecordInfo;
import com.ai.mapper.made.CoalRoutingInspectionAlarmRecordInfoMapper;
import com.ai.service.made.ICoalRoutingInspectionAlarmRecordInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jiaok
 * @since 2024-10-29
 */
@Service
public class CoalRoutingInspectionAlarmRecordInfoServiceImpl extends ServiceImpl<CoalRoutingInspectionAlarmRecordInfoMapper, CoalRoutingInspectionAlarmRecordInfo> implements ICoalRoutingInspectionAlarmRecordInfoService {

    @Override
    public CommonResponse inspectionInfo(String inspectAlarmRecordId) {

        List<CoalRoutingInspectionAlarmRecordInfo> recordInfoList = this.list(new QueryWrapper<CoalRoutingInspectionAlarmRecordInfo>()
                .eq("inspect_alarm_record_id", inspectAlarmRecordId)
                .gt("inspect_times",0)
                .orderByAsc("inspect_begin_time"));

        return CommonResponse.ok(recordInfoList);
    }

    @Override
    public String getFinalDate(String id) {
        return baseMapper.getFinalDate(id);
    }
}
